package com.linzp.bishe.config;

import com.linzp.bishe.common.SaveAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName WebMvcConfiguration
 * @Description webMvc1配置代理静态资源
 * @Author LinZePeng
 * @Date 2022/1/17 14:13
 * @Version 1.0
 */
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
	@Autowired
	private SaveAddress saveAddress;
	/**
	 * @Description 第一个参数是访问路径，第2个参数是存放的物理地址
	 * @Param [registry]
	 * @return void
	 */
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler(saveAddress.getAccessPath()+"**").addResourceLocations("file:"+saveAddress.getAllAddress());
	}
}
